package cn.shrek.service.impl;

import cn.shrek.bean.Student;
import cn.shrek.mapper.StudentMapper;
import cn.shrek.service.StudentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class StudentServiceImpl implements StudentService {
    @Resource
    private StudentMapper studentMapper;

    /**
     *通过id查找用户
     * @param s_id
     * @return
     */
    @Override
    public List<Student> findById(int s_id) {

        return studentMapper.findById(s_id);
    }

    /**
     * 查询全部
     * @return
     */
    @Override
    public List<Student> findAll() {
        return studentMapper.findAll();
    }

    @Override
    public void add(Student student) {
        studentMapper.insert(student);
    }

    @Override
    public void update(Student student) {
         studentMapper.updateByPrimaryKey(student);
    }

    @Override
    public int delete(int s_id) {
        return studentMapper.deleteByPrimaryKey(s_id);
    }
}
